<? echo'<?xml version="1.0" encoding="UTF-8"?>'?>

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<? foreach ($pages as $value): ?>
<url>
	<loc><?=base_url().$value->pUrl?></loc>
</url>
<? if (!empty($articles[$value->id])):?>
<? foreach ($articles[$value->id] as $val): ?>
<url>
	<loc><?=base_url().$value->pUrl.'/'.$val->pUrl?></loc>
	<lastmod><?=date('Y-m-d', $val->dUpdated?$val->dUpdated:$val->dCreated)?></lastmod>
</url>
<? endforeach; ?>
<? endif; ?>
<? endforeach; ?>
</urlset> 